import Mock from "mockjs2";
import { builder } from "../util";

const login = () => {
  return builder({
    token:
      "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJsdHdsIiwiYXVkIjoiIiwiaWF0IjoxNTg4MTI4MzYwLCJkYXRhIjp7InVpZCI6NCwicGhvbmUiOiIxNzMzOTYxMjc5MyJ9fQ.kFicIkMmDUcYkKO60skk-caQToesUekGblaP7M44gMg", //登录成功返回的token信息
    user_type: 1 //账号类型1=前台注册用户,2=推广用户,3=后台上单,4=后台管理
  });
};

const loginout = () => {
  return builder({
    code: 200,
    msg: "退出成功",
    data: []
  });
};

const doUpload = () => {
  return builder({
    url: "img.letuilm.com/2020/04/f3ccdd2020042910390150281.jpg" //图片地址
  });
};

const getSms = () => {
  return builder({
    code: 200,
    msg: "发送成功",
    data: []
  });
};

const doUserRegister = () => {
  return builder({
    code: 200,
    msg: "注册成功",
    data: []
  });
};
const doRegister = () => {
  return builder({
    code: 200,
    msg: "注册成功",
    data: []
  });
};

const doEditPass = () => {
  return builder({
    code: 200,
    msg: "修改成功",
    data: []
  });
};

const register = () => {
  return builder({
    code: 200,
    msg: "注册成功",
    data: []
  });
};

Mock.mock(/\/local\/login/, "post", login);
Mock.mock(/\/local\/loginout/, "post", loginout);
Mock.mock(/\/local\/doUpload/, "post", doUpload);
Mock.mock(/\/local\/getSms/, "post", getSms);
Mock.mock(/\/local\/doRegister/, "post", doRegister);
Mock.mock(/\/local\/doUserRegister/, "post", doUserRegister);
Mock.mock(/\/local\/doEditPass/, "post", doEditPass);
Mock.mock(/\/local\/register/, "post", register);
